using UnityEngine;
using UnityEngine.UI;

/****************************************************
// 功能：小兵血条
// | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
// | Copyright (c) 2021-2025 聊来 All rights reserved.
// | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">聊来</a> )
// | @Author: 贯彻己道的云 <18970881148@qq.com>
// | DateTime: 2025/4/3 20:42:52
*****************************************************/

public class ItemHpSoldier: ItemHp
{
    public Image iconState;

    public override void InitItem(MainLogicUnit unit, Transform root, int hp)
    {
        base.InitItem(unit, root, hp);
        
        SetActive(iconState, false);

        SetSprite(imageProgress, isFriend ? "Images/player/selfteamhpfg" : "Images/player/enemyteamhpfg");
    }

    public override void SetStateInfo(StateEnum state, bool show)
    {
        base.SetStateInfo(state, show);
        if (!show)
        {
            SetActive(iconState, false);
        }
        else
        {
            // 血条下方图标显示
            switch(state) {
                case StateEnum.Silenced:
                    SetSprite(iconState, "Images/player/silenceIcon");
                    break;
                case StateEnum.Knockup:
                    SetSprite(iconState, "Images/player/stunIcon");
                    break;
                case StateEnum.Stunned:
                    SetSprite(iconState, "Images/player/stunIcon");
                    break;
                //TODO
                case StateEnum.Invincible:
                case StateEnum.Restricted:
                case StateEnum.None:
                default:
                    break;
            }

            SetActive(iconState);
            iconState.SetNativeSize();
        }
    }
}
